﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;

namespace OnlineMovieTicket.Utilities
{
    public class Email
    {

        public void sendEmail(string to, string subject, string message)
        {
            

            MailMessage MyMailMessage = new MailMessage();
            MyMailMessage.To.Add(to);
            MyMailMessage.Subject = subject;
            MyMailMessage.Body = message;
            MyMailMessage.From = new MailAddress("tgvcinema@gmail.com");
     
            MyMailMessage.IsBodyHtml = false;
            System.Net.NetworkCredential mailAuthentication = new
            System.Net.NetworkCredential("tgvcinema@gmail.com", "passw0rd");
            System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
            mailClient.EnableSsl = true;
            mailClient.UseDefaultCredentials = false;
            mailClient.Credentials = mailAuthentication;
            mailClient.Send(MyMailMessage);       
        
        }


    }
}
